<template>
    <h3>{{sTUpdateItem.id?'修改':'新增'}}学生</h3>
    <div>
        <label for="">学生姓名：</label>
    <input type="text" v-model.lazy="sTUpdateItem.name">
    </div>
    <div>
        <label for="">学生年龄：</label>
    <input type="text" v-model.lazy="sTUpdateItem.age">
    </div>
    <button @click="$emit('onChangeStudent',sTUpdateItem)">确认{{sTUpdateItem.id?'修改':'新增'}}</button>
</template>

<script setup>
import { ref, watch } from 'vue';
defineEmits(['onChangeStudent']);
const {toRenderStudentInfo} = defineProps(['toRenderStudentInfo']);

const sTUpdateItem =  ref({});
const text = ref();

watch(()=>toRenderStudentInfo,()=>{
    sTUpdateItem.value=toRenderStudentInfo;
})


</script>

<style scoped>

</style>